﻿using System.Windows;
using System.Windows.Controls;

namespace AllanPlugins
{

    public partial class MyMenu : MenuItem
    {
        public MyMenu()
        {
            InitializeComponent();
        }

        private void loadPlugin()
        {
            if(mDuowanImportForm == null)
            mDuowanImportForm = new DuowanImportForm();
            mDuowanImportForm.Show();
        }
        public void unloadPlugin() {
            mDuowanImportForm.Dispose();
        }
        private DuowanImportForm mDuowanImportForm;

        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            if (mDuowanImportForm == null)
            {
                loadPlugin();
            }
            else
            {
                if (mDuowanImportForm.IsDisposed)
                {
                    mDuowanImportForm = null;
                    loadPlugin();
                }
                else
                    unloadPlugin();
            }
        }

    }
}
